<template>
    <div>
        <!-- 定义-排班计划 -->
        <el-row>
            <el-col :span="24">
                <div class="container">
                    <avue-crud :data="planList[0].data" :option="planList[0].option" @current-row-change="rowChange"  @current-change="paiBanPage" :page="this.planList[0].page"></avue-crud>
                </div>
            </el-col>
        </el-row>
        
    </div>
</template>

<script>
import qs from "qs";
import TableData from "../../components/common/tableData";
export default {
  data: function() {
    return {
      activeTag: "2-2",
      planList: [
        {
          page: {
            pageSizes: [10],
            total: 2,
            currentPage: 1,
            pageSize: 10
          },
          data: [],
          option: {
            page: true,
            stripe: true,
            menu: false,
            align: "center",
            menuAlign: "center",
            column: []
          }
        }
      ],
      pageRow: {
        page: "1",
        rows: "30"
      }
    };
  },
  methods: {
    tableCreate() {
      this.planList[0].option.column.push(
        {
          label: "班次号",
          prop: "bus_id"
        },
        {
          label: "起初日期",
          prop: "start_date"
        },
        {
          label: "结束日期",
          prop: "end_date"
        },
        {
          label: "排班",
          prop: "type"
        },
        {
          label: "备注",
          prop: "remarks"
        }
      );
    },
    paiBanPage(val){
      this.planList[0].page.currentPage=val;
      this.getPlanList();
    },
    getPlanList() {
      this.postRequest(
          "/sch/bus/define/scheduling/list",
          {
            page:this.planList[0].page.currentPage,
            row:"10"
          }
        )
        .then(data => {
          console.log(data);
          this.planList[0].page.total=data.data.totalRow;
          this.planList[0].data=data.data.list;
        });
    },
    rowChange(){}
  },
  computed: {},
  components: { TableData },
  watch: {},
  mounted() {
    console.log("paiBanPlan");
    this.$emit("sendActive", this.activeTag);
    this.tableCreate();
    this.getPlanList();
  }
};
</script>
<style scoped src="../../assets/css/service/paiBanPlan.css">
</style>